<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="stable/static/css/site.css" rel="stylesheet" type="text/css">
    <link href="stable/static/css/print.css" rel="stylesheet" type="text/css" media="print">
    <link href="stable/static/css/prettify.css" rel="stylesheet" type="text/css">
    <link href="//www.google.com/images/icons/product/chrome-16.png" rel="icon" type="image/ico">
    <link href="stable/static/css/api.css" rel="stylesheet" type="text/css">
    <title>chrome.tabs - chrome插件中文开发文档(非官方)</title>
  </head>
  <body>
    <a id="top"></a>
    <div id="header">{Header content}</div>
    <a id="gc-topnav-anchor"></a>
    <div id="gc-topnav">
      <h1>Google Chrome Extensions</h1>
      <ul id="home" class="gc-topnav-tabs">
        <li id="home_link">
          <a href="index.html" title="Google Chrome Extensions home page"><div>Home</div></a>
        </li>
        <li id="docs_link">
          <a href="docs.html" title="Official Google Chrome Extensions documentation"><div>Docs</div></a>
        </li>
        <li id="faq_link">
          <a href="faq.html" title="Answers to frequently asked questions about Google Chrome Extensions"><div>FAQ</div></a>
        </li>
        <li id="samples_link">
          <a href="samples.html" title="Sample Extensions (with source code)"><div>Samples</div></a>
        </li>
        <li id="group_link">
          <a href="http://groups.google.com/a/chromium.org/group/chromium-extensions" title="Google Chrome Extensions developer forum"><div>Group</div></a>
        </li>
        <li id="so_link">
          <a href="http://stackoverflow.com/questions/tagged/google-chrome-extension" title="[google-chrome-extension] tag on Stack Overflow"><div>Questions?</div></a>
        </li>
      </ul>
    </div>
    <div id="gc-container">
      <div id="gc-sidebar">
        <ul 
            class="level1 ">
          <li class="level2">
                <a href="getstarted.html" class="level2 ">Getting Started</a>
          </li>
          <li class="level2">
                <a href="overview.html" class="level2 ">Overview</a>
          </li>
          <li class="level2">
                <a href="whats_new.html" class="level2 ">What's New?</a>
          </li>
          <li class="level2">
                <a href="devguide.html" class="level2 ">Developer's Guide</a>
              <ul 
                  class="level2 ">
                <li class="level3">
                    <a class="button level3">
                      <span class="level3">Browser UI</span>
                      <div class="toggleIndicator level3"></div>
                    </a>
                    <ul toggleable
                        class="level3 hidden">
                      <li class="level4">
                            <a href="browserAction.html" class="level4 ">Browser Actions</a>
                      </li>
                      <li class="level4">
                            <a href="contextMenus.html" class="level4 ">Context Menus</a>
                      </li>
                      <li class="level4">
                            <a href="notifications.html" class="level4 ">Desktop Notifications</a>
                      </li>
                      <li class="level4">
                            <a href="omnibox.html" class="level4 ">Omnibox</a>
                      </li>
                      <li class="level4">
                            <a href="options.html" class="level4 ">Options Pages</a>
                      </li>
                      <li class="level4">
                            <a href="override.html" class="level4 ">Override Pages</a>
                      </li>
                      <li class="level4">
                            <a href="pageAction.html" class="level4 ">Page Actions</a>
                      </li>
                    </ul>
                </li>
                <li class="level3">
                    <a class="button level3">
                      <span class="level3">Browser Interaction</span>
                      <div class="toggleIndicator level3 toggled"></div>
                    </a>
                    <ul toggleable
                        class="level3 ">
                      <li class="level4">
                            <a href="bookmarks.html" class="level4 ">Bookmarks</a>
                      </li>
                      <li class="level4">
                            <a href="cookies.html" class="level4 ">Cookies</a>
                      </li>
                      <li class="level4">
                            <a href="devtools.html" class="level4 ">Developer Tools</a>
                      </li>
                      <li class="level4">
                            <a href="events.html" class="level4 ">Events</a>
                      </li>
                      <li class="level4">
                            <a href="history.html" class="level4 ">History</a>
                      </li>
                      <li class="level4">
                            <a href="management.html" class="level4 ">Management</a>
                      </li>
                      <li class="level4">
                            <a  class="level4 selected">Tabs</a>
                      </li>
                      <li class="level4">
                            <a href="windows.html" class="level4 ">Windows</a>
                      </li>
                    </ul>
                </li>
                <li class="level3">
                    <a class="button level3">
                      <span class="level3">Implementation</span>
                      <div class="toggleIndicator level3"></div>
                    </a>
                    <ul toggleable
                        class="level3 hidden">
                      <li class="level4">
                            <a href="a11y.html" class="level4 ">Accessibility</a>
                      </li>
                      <li class="level4">
                            <a href="event_pages.html" class="level4 ">Event Pages</a>
                      </li>
                      <li class="level4">
                            <a href="contentSecurityPolicy.html" class="level4 ">Content Security Policy</a>
                      </li>
                      <li class="level4">
                            <a href="content_scripts.html" class="level4 ">Content Scripts</a>
                      </li>
                      <li class="level4">
                            <a href="xhr.html" class="level4 ">Cross-Origin XHR</a>
                      </li>
                      <li class="level4">
                            <a href="i18n.html" class="level4 ">Internationalization</a>
                      </li>
                      <li class="level4">
                            <a href="messaging.html" class="level4 ">Message Passing</a>
                      </li>
                      <li class="level4">
                            <a href="permissions.html" class="level4 ">Optional Permissions</a>
                      </li>
                      <li class="level4">
                            <a href="npapi.html" class="level4 ">NPAPI Plugins</a>
                      </li>
                    </ul>
                </li>
                <li class="level3">
                    <a class="button level3">
                      <span class="level3">Finishing</span>
                      <div class="toggleIndicator level3"></div>
                    </a>
                    <ul toggleable
                        class="level3 hidden">
                      <li class="level4">
                            <a href="hosting.html" class="level4 ">Hosting</a>
                      </li>
                      <li class="level4">
                            <a href="external_extensions.html" class="level4 ">Other Deployment Options</a>
                      </li>
                    </ul>
                </li>
              </ul>
          </li>
          <li class="level2">
                <a href="tutorials.html" class="level2 ">Tutorials</a>
              <ul 
                  class="level2 ">
                <li class="level3">
                      <a href="tut_migration_to_manifest_v2.html" class="level3 ">Manifest V2</a>
                </li>
                <li class="level3">
                      <a href="tut_debugging.html" class="level3 ">Debugging</a>
                </li>
                <li class="level3">
                      <a href="tut_analytics.html" class="level3 ">Google Analytics</a>
                </li>
                <li class="level3">
                      <a href="tut_oauth.html" class="level3 ">OAuth</a>
                </li>
              </ul>
          </li>
          <li class="level2">
                <span class="level2">Reference</span>
              <ul 
                  class="level2 ">
                <li class="level3">
                    <a class="button level3">
                      <span class="level3">Formats</span>
                      <div class="toggleIndicator level3"></div>
                    </a>
                    <ul toggleable
                        class="level3 hidden">
                      <li class="level4">
                            <a href="manifest.html" class="level4 ">Manifest Files</a>
                      </li>
                      <li class="level4">
                            <a href="match_patterns.html" class="level4 ">Match Patterns</a>
                      </li>
                    </ul>
                </li>
                <li class="level3">
                      <a href="permission_warnings.html" class="level3 ">Permission Warnings</a>
                </li>
                <li class="level3">
                      <a href="api_index.html" class="level3 ">chrome.* APIs</a>
                </li>
                <li class="level3">
                      <a href="api_other.html" class="level3 ">Other APIs</a>
                </li>
              </ul>
          </li>
          <li class="level2">
                <span class="level2">More</span>
              <ul 
                  class="level2 ">
                <li class="level3">
                      <a href="http://code.google.com/chrome/webstore/docs/index.html" class="level3 ">Chrome Web Store</a>
                </li>
                <li class="level3">
                      <a href="http://code.google.com/chrome/apps/docs/developers_guide.html" class="level3 ">Hosted Apps</a>
                </li>
                <li class="level3">
                      <a href="themes.html" class="level3 ">Themes</a>
                </li>
              </ul>
          </li>
        </ul>
      </div>
      <div id="gc-pagecontent">
        <h1 class="page_title">chrome.tabs</h1>
        
        
        
        <div id="toc">
          <h2>Contents</h2>
          <ol>
            <li>
              <a href=#manifest>Manifest</a>
            </li>
            <li>
              <a href=#examples> Examples </a>
            </li>
            <li>
              <a href="#apiReference">API reference: chrome.tabs</a>
              <ol>
                  <li><a href="#types">Types</a><ol>  <li>    <a href="#type-Tab">Tab</a>  </li>  <li>    <a href="#type-InjectDetails">InjectDetails</a>  </li></ol></li>
                  
                  <li><a href="#methods">Methods</a><ol>  <li><a href="#method-get">get</a></li>  <li><a href="#method-getCurrent">getCurrent</a></li>  <li><a href="#method-connect">connect</a></li>  <li><a href="#method-sendMessage">sendMessage</a></li>  <li><a href="#method-create">create</a></li>  <li><a href="#method-duplicate">duplicate</a></li>  <li><a href="#method-query">query</a></li>  <li><a href="#method-highlight">highlight</a></li>  <li><a href="#method-update">update</a></li>  <li><a href="#method-move">move</a></li>  <li><a href="#method-reload">reload</a></li>  <li><a href="#method-remove">remove</a></li>  <li><a href="#method-detectLanguage">detectLanguage</a></li>  <li><a href="#method-captureVisibleTab">captureVisibleTab</a></li>  <li><a href="#method-executeScript">executeScript</a></li>  <li><a href="#method-insertCSS">insertCSS</a></li></ol></li>
                  <li><a href="#events">Events</a><ol>  <li><a href="#event-onCreated">onCreated</a></li>  <li><a href="#event-onUpdated">onUpdated</a></li>  <li><a href="#event-onMoved">onMoved</a></li>  <li><a href="#event-onActivated">onActivated</a></li>  <li><a href="#event-onHighlighted">onHighlighted</a></li>  <li><a href="#event-onDetached">onDetached</a></li>  <li><a href="#event-onAttached">onAttached</a></li>  <li><a href="#event-onRemoved">onRemoved</a></li></ol></li>
                  <li><a href="#samples">Sample Extensions</a></li>
              </ol>
            </li>
          </ol>
        </div>

<p id="classSummary">
Use the <code>chrome.tabs</code> module
to interact with the browser's tab system.
You can use this module to
create, modify, and rearrange tabs in the browser.
</p>

<img src="stable/static/images/tabs.png"
     width="323" height="50" alt="Two tabs in a window" />

<h2 id="manifest">Manifest</h2>
<p>
Almost all <code>chrome.tabs</code> methods require you to
declare the "tabs" permission
in the <a href="manifest.html">extension manifest</a>.
For example:
</p>

<pre>{
  "name": "My extension",
  ...
  <b>"permissions": [
    "tabs"
  ]</b>,
  ...
}</pre>

<p>
Three methods (<a href="#method-create"><code>create</code></a>,
<a href="#method-update"><code>update</code></a> and
<a href="#method-remove"><code>remove</code></a>) and one event
(<a href="#event-onRemoved"><code>onRemoved</code></a>) don't require the "tabs"
permission.
</p>


<h2 id="examples"> Examples </h2>

<p>
You can find simple examples of using the tabs module in the
<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/tabs/">examples/api/tabs</a>
directory.
For other examples and for help in viewing the source code, see
<a href="samples.html">Samples</a>.
</p>
        <h2 id="apiReference">API Reference: chrome.tabs</h2>
        <div class="api_reference">
            <h3 id="types">Types</h3>
              <div>
                <h3 id="type-Tab">Tab</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">object</span>  )</span></dt>
                  <h4 id="Tab-properties">
                    Properties of <a href="#type-Tab">Tab</a>
                  </h4>
                  <dd><dl>      <div>
                      <a name="property-Tab-id"></a>
                      <dt>
                        <span class="variable">id</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The ID of the tab. Tab IDs are unique within a browser session.
                      </dd>
                    </div>
                    <div>
                      <a name="property-Tab-index"></a>
                      <dt>
                        <span class="variable">index</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The zero-based index of the tab within its window.
                      </dd>
                    </div>
                    <div>
                      <a name="property-Tab-windowId"></a>
                      <dt>
                        <span class="variable">windowId</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The ID of the window the tab is contained within.
                      </dd>
                    </div>
                    <div>
                      <a name="property-Tab-openerTabId"></a>
                      <dt>
                        <span class="variable">openerTabId</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The ID of the tab that opened this tab, if any. This will only be present if the opener tab still exists.
                      </dd>
                    </div>
                    <div>
                      <a name="property-Tab-highlighted"></a>
                      <dt>
                        <span class="variable">highlighted</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Whether the tab is highlighted.
                      </dd>
                    </div>
                    <div>
                      <a name="property-Tab-active"></a>
                      <dt>
                        <span class="variable">active</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Whether the tab is active in its window.
                      </dd>
                    </div>
                    <div>
                      <a name="property-Tab-pinned"></a>
                      <dt>
                        <span class="variable">pinned</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Whether the tab is pinned.
                      </dd>
                    </div>
                    <div>
                      <a name="property-Tab-url"></a>
                      <dt>
                        <span class="variable">url</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The URL the tab is displaying. This will only be present if the extension has the 'tabs' or 'webNavigation' permission.
                      </dd>
                    </div>
                    <div>
                      <a name="property-Tab-title"></a>
                      <dt>
                        <span class="variable">title</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The title of the tab. This will only be present if the extension has the 'tabs' or 'webNavigation' permission. It may also be an empty string if the tab is loading.
                      </dd>
                    </div>
                    <div>
                      <a name="property-Tab-favIconUrl"></a>
                      <dt>
                        <span class="variable">favIconUrl</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The URL of the tab's favicon. This will only be present if the extension has the 'tabs' or 'webNavigation' permission. It may also be an empty string if the tab is loading.
                      </dd>
                    </div>
                    <div>
                      <a name="property-Tab-status"></a>
                      <dt>
                        <span class="variable">status</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Either <em>loading</em> or <em>complete</em>.
                      </dd>
                    </div>
                    <div>
                      <a name="property-Tab-incognito"></a>
                      <dt>
                        <span class="variable">incognito</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Whether the tab is in an incognito window.
                      </dd>
                    </div>
              </dl></dd>
                </div>
              </div>
              <div>
                <h3 id="type-InjectDetails">InjectDetails</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">object</span>  )</span></dt>
              <dd>
                    Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
                  </dd>    <h4 id="InjectDetails-properties">
                    Properties of <a href="#type-InjectDetails">InjectDetails</a>
                  </h4>
                  <dd><dl>      <div>
                      <a name="property-InjectDetails-code"></a>
                      <dt>
                        <span class="variable">code</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        JavaScript or CSS code to inject.
                      </dd>
                    </div>
                    <div>
                      <a name="property-InjectDetails-file"></a>
                      <dt>
                        <span class="variable">file</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        JavaScript or CSS file to inject.
                      </dd>
                    </div>
                    <div>
                      <a name="property-InjectDetails-allFrames"></a>
                      <dt>
                        <span class="variable">allFrames</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        If allFrames is <code>true</code>, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's <code>false</code> and will only be injected into the top frame.
                      </dd>
                    </div>
                    <div>
                      <a name="property-InjectDetails-runAt"></a>
                      <dt>
                        <span class="variable">runAt</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">enumerated string ["document_start", "document_end", "document_idle"]</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle".
                      </dd>
                    </div>
              </dl></dd>
                </div>
              </div>
            <h3 id="methods">Methods</h3>
              <div>
                <h4 id="method-get">get</h4>
                <div class="summary lower">
                  <span>chrome.tabs.get</span>(<span>integer <span class="variable">tabId</span></span>)
                </div>
                <div class="description">
              <p>
                    Retrieves details about the specified tab.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-get-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt></div>
                  </dl>
                  <h4>Callback function</h4><p>      The <em>callback</em> parameter should specify a function      that looks like this:</p><pre>function(<a href="tabs.html#type-Tab">Tab</a> tab) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-tab"></a>  <dt>    <span class="variable">tab</span>    <span class="property">      (                <span id="typeTemplate"><a href="tabs.html#type-Tab">Tab</a></span>      )    </span>  </dt></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-getCurrent">getCurrent</h4>
                <div class="summary lower">
                  <span>chrome.tabs.getCurrent</span>()
                </div>
                <div class="description">
              <p>
                    Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a background page or popup view).
                  </p>  </div>
              </div>
              <div>
                <h4 id="method-connect">connect</h4>
                <div class="summary">
                  <span><a href="extension.html#type-Port">extension.Port</a> chrome.tabs.connect</span>(<span>integer <span class="variable">tabId</span></span>, <span class="optional">object <span class="variable">connectInfo</span></span>)
                </div>
                <div class="description">
              <p>
                    Connects to the content script(s) in the specified tab. The <a href='extension.html#event-onConnect'>chrome.extension.onConnect</a> event is fired in each content script running in the specified tab for the current extension. For more details, see <a href='content_scripts.html#messaging'>Content Script Messaging</a>.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-connect-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt></div><div>  <a name="property-connect-connectInfo"></a>  <dt>    <span class="variable">connectInfo</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-connectInfo-name"></a>        <dt>          <span class="variable">name</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">string</span>            )          </span>        </dt>        <dd>          Will be passed into onConnect for content scripts that are listening for the connection event.        </dd>      </div>    </dl>  </dd></div>
                  </dl>
                  
                </div>
              </div>
              <div>
                <h4 id="method-sendMessage">sendMessage</h4>
                <div class="summary lower">
                  <span>chrome.tabs.sendMessage</span>(<span>integer <span class="variable">tabId</span></span>, <span>any <span class="variable">message</span></span>)
                </div>
                <div class="description">
              <p>
                    Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back.  The <a href='extension.html#event-onMessage'>chrome.extension.onMessage</a> event is fired in each content script running in the specified tab for the current extension.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-sendMessage-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt></div><div>  <a name="property-sendMessage-message"></a>  <dt>    <span class="variable">message</span>    <span class="property">      (                <span id="typeTemplate">any</span>      )    </span>  </dt></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>responseCallback</em> parameter, it should      specify a function that looks like this:</p><pre>function(any response) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-responseCallback-response"></a>  <dt>    <span class="variable">response</span>    <span class="property">      (                <span id="typeTemplate">any</span>      )    </span>  </dt>  <dd>    The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will be set to the error message.  </dd></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-create">create</h4>
                <div class="summary lower">
                  <span>chrome.tabs.create</span>(<span>object <span class="variable">createProperties</span></span>)
                </div>
                <div class="description">
              <p>
                    Creates a new tab. Note: This function can be used without requesting the 'tabs' permission in the manifest.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-create-createProperties"></a>  <dt>    <span class="variable">createProperties</span>    <span class="property">      (                <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-createProperties-windowId"></a>        <dt>          <span class="variable">windowId</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          The window to create the new tab in. Defaults to the <a href='windows.html#current-window'>current window</a>.        </dd>      </div>      <div>        <a name="property-createProperties-index"></a>        <dt>          <span class="variable">index</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window.        </dd>      </div>      <div>        <a name="property-createProperties-url"></a>        <dt>          <span class="variable">url</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">string</span>            )          </span>        </dt>        <dd>          The URL to navigate the tab to initially. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page.        </dd>      </div>      <div>        <a name="property-createProperties-active"></a>        <dt>          <span class="variable">active</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          Whether the tab should become the active tab in the window. Defaults to <var>true</var>        </dd>      </div>      <div>        <a name="property-createProperties-pinned"></a>        <dt>          <span class="variable">pinned</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          Whether the tab should be pinned. Defaults to <var>false</var>        </dd>      </div>      <div>        <a name="property-createProperties-openerTabId"></a>        <dt>          <span class="variable">openerTabId</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as the newly created tab.        </dd>      </div>    </dl>  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>callback</em> parameter, it should      specify a function that looks like this:</p><pre>function(<a href="tabs.html#type-Tab">Tab</a> tab) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-tab"></a>  <dt>    <span class="variable">tab</span>    <span class="property">      (                <span id="typeTemplate"><a href="tabs.html#type-Tab">Tab</a></span>      )    </span>  </dt>  <dd>    Details about the created tab. Will contain the ID of the new tab.  </dd></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-duplicate">duplicate</h4>
                <div class="summary lower">
                  <span>chrome.tabs.duplicate</span>(<span>integer <span class="variable">tabId</span></span>)
                </div>
                <div class="description">
              <p>
                    Duplicates a tab. Note: This function can be used without requesting the 'tabs' permission in the manifest.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-duplicate-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt>  <dd>    The ID of the tab which is to be duplicated.  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>callback</em> parameter, it should      specify a function that looks like this:</p><pre>function(<a href="tabs.html#type-Tab">Tab</a> tab) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-tab"></a>  <dt>    <span class="variable">tab</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate"><a href="tabs.html#type-Tab">Tab</a></span>      )    </span>  </dt>  <dd>    Details about the duplicated tab. The Tab object doesn't contain url, title and faviconUrl if the 'tabs' permission has not been requested.  </dd></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-query">query</h4>
                <div class="summary lower">
                  <span>chrome.tabs.query</span>(<span>object <span class="variable">queryInfo</span></span>)
                </div>
                <div class="description">
              <p>
                    Gets all tabs that have the specified properties, or all tabs if no properties are specified.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-query-queryInfo"></a>  <dt>    <span class="variable">queryInfo</span>    <span class="property">      (                <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-queryInfo-active"></a>        <dt>          <span class="variable">active</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          Whether the tabs are active in their windows.        </dd>      </div>      <div>        <a name="property-queryInfo-pinned"></a>        <dt>          <span class="variable">pinned</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          Whether the tabs are pinned.        </dd>      </div>      <div>        <a name="property-queryInfo-highlighted"></a>        <dt>          <span class="variable">highlighted</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          Whether the tabs are highlighted.        </dd>      </div>      <div>        <a name="property-queryInfo-currentWindow"></a>        <dt>          <span class="variable">currentWindow</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          Whether the tabs are in the <a href='windows.html#current-window'>current window</a>.        </dd>      </div>      <div>        <a name="property-queryInfo-lastFocusedWindow"></a>        <dt>          <span class="variable">lastFocusedWindow</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          Whether the tabs are in the last focused window.        </dd>      </div>      <div>        <a name="property-queryInfo-status"></a>        <dt>          <span class="variable">status</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">enumerated string ["loading", "complete"]</span>            )          </span>        </dt>        <dd>          Whether the tabs have completed loading.        </dd>      </div>      <div>        <a name="property-queryInfo-title"></a>        <dt>          <span class="variable">title</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">string</span>            )          </span>        </dt>        <dd>          Match page titles against a pattern.        </dd>      </div>      <div>        <a name="property-queryInfo-url"></a>        <dt>          <span class="variable">url</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">string</span>            )          </span>        </dt>        <dd>          Match tabs against a URL pattern.        </dd>      </div>      <div>        <a name="property-queryInfo-windowId"></a>        <dt>          <span class="variable">windowId</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          The ID of the parent window, or <a href='windows.html#property-WINDOW_ID_CURRENT'>chrome.windows.WINDOW_ID_CURRENT</a> for the <a href='windows.html#current-window'>current window</a>.        </dd>      </div>      <div>        <a name="property-queryInfo-windowType"></a>        <dt>          <span class="variable">windowType</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">enumerated string ["normal", "popup", "panel", "app"]</span>            )          </span>        </dt>        <dd>          The type of window the tabs are in.        </dd>      </div>      <div>        <a name="property-queryInfo-index"></a>        <dt>          <span class="variable">index</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          The position of the tabs within their windows.        </dd>      </div>    </dl>  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      The <em>callback</em> parameter should specify a function      that looks like this:</p><pre>function(array of <a href="tabs.html#type-Tab">Tab</a> result) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-result"></a>  <dt>    <span class="variable">result</span>    <span class="property">      (                <span id="typeTemplate">array of <a href="tabs.html#type-Tab">Tab</a></span>      )    </span>  </dt></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-highlight">highlight</h4>
                <div class="summary lower">
                  <span>chrome.tabs.highlight</span>(<span>object <span class="variable">highlightInfo</span></span>)
                </div>
                <div class="description">
              <p>
                    Highlights the given tabs.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-highlight-highlightInfo"></a>  <dt>    <span class="variable">highlightInfo</span>    <span class="property">      (                <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-highlightInfo-windowId"></a>        <dt>          <span class="variable">windowId</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          The window that contains the tabs.        </dd>      </div>      <div>        <a name="property-highlightInfo-tabs"></a>        <dt>          <span class="variable">tabs</span>          <span class="property">            (                            <span id="typeTemplate">array of integer or integer</span>            )          </span>        </dt>        <dd>          One or more tab indices to highlight.        </dd>      </div>    </dl>  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      The <em>callback</em> parameter should specify a function      that looks like this:</p><pre>function(<a href="windows.html#type-Window">windows.Window</a> window) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-window"></a>  <dt>    <span class="variable">window</span>    <span class="property">      (                <span id="typeTemplate"><a href="windows.html#type-Window">windows.Window</a></span>      )    </span>  </dt>  <dd>    Contains details about the window whose tabs were highlighted.  </dd></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-update">update</h4>
                <div class="summary lower">
                  <span>chrome.tabs.update</span>(<span class="optional">integer <span class="variable">tabId</span></span>, <span>object <span class="variable">updateProperties</span></span>)
                </div>
                <div class="description">
              <p>
                    Modifies the properties of a tab. Properties that are not specified in <var>updateProperties</var> are not modified. Note: This function can be used without requesting the 'tabs' permission in the manifest.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-update-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate">integer</span>      )    </span>  </dt>  <dd>    Defaults to the selected tab of the <a href='windows.html#current-window'>current window</a>.  </dd></div><div>  <a name="property-update-updateProperties"></a>  <dt>    <span class="variable">updateProperties</span>    <span class="property">      (                <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-updateProperties-url"></a>        <dt>          <span class="variable">url</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">string</span>            )          </span>        </dt>        <dd>          A URL to navigate the tab to.        </dd>      </div>      <div>        <a name="property-updateProperties-active"></a>        <dt>          <span class="variable">active</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          Whether the tab should be active.        </dd>      </div>      <div>        <a name="property-updateProperties-highlighted"></a>        <dt>          <span class="variable">highlighted</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          Adds or removes the tab from the current selection.        </dd>      </div>      <div>        <a name="property-updateProperties-pinned"></a>        <dt>          <span class="variable">pinned</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          Whether the tab should be pinned.        </dd>      </div>      <div>        <a name="property-updateProperties-openerTabId"></a>        <dt>          <span class="variable">openerTabId</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab.        </dd>      </div>    </dl>  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>callback</em> parameter, it should      specify a function that looks like this:</p><pre>function(<a href="tabs.html#type-Tab">Tab</a> tab) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-tab"></a>  <dt>    <span class="variable">tab</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate"><a href="tabs.html#type-Tab">Tab</a></span>      )    </span>  </dt>  <dd>    Details about the updated tab, or <code>null</code> if the 'tabs' permission has not been requested.  </dd></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-move">move</h4>
                <div class="summary lower">
                  <span>chrome.tabs.move</span>(<span>array of integer or integer <span class="variable">tabIds</span></span>, <span>object <span class="variable">moveProperties</span></span>)
                </div>
                <div class="description">
              <p>
                    Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-move-tabIds"></a>  <dt>    <span class="variable">tabIds</span>    <span class="property">      (                <span id="typeTemplate">array of integer or integer</span>      )    </span>  </dt>  <dd>    The tab or list of tabs to move.  </dd></div><div>  <a name="property-move-moveProperties"></a>  <dt>    <span class="variable">moveProperties</span>    <span class="property">      (                <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-moveProperties-windowId"></a>        <dt>          <span class="variable">windowId</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          Defaults to the window the tab is currently in.        </dd>      </div>      <div>        <a name="property-moveProperties-index"></a>        <dt>          <span class="variable">index</span>          <span class="property">            (                            <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          The position to move the window to. -1 will place the tab at the end of the window.        </dd>      </div>    </dl>  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>callback</em> parameter, it should      specify a function that looks like this:</p><pre>function(array of <a href="tabs.html#type-Tab">Tab</a> or <a href="tabs.html#type-Tab">Tab</a> tabs) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-tabs"></a>  <dt>    <span class="variable">tabs</span>    <span class="property">      (                <span id="typeTemplate">array of <a href="tabs.html#type-Tab">Tab</a> or <a href="tabs.html#type-Tab">Tab</a></span>      )    </span>  </dt>  <dd>    Details about the moved tabs.  </dd></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-reload">reload</h4>
                <div class="summary lower">
                  <span>chrome.tabs.reload</span>(<span class="optional">integer <span class="variable">tabId</span></span>, <span class="optional">object <span class="variable">reloadProperties</span></span>)
                </div>
                <div class="description">
              <p>
                    Reload a tab.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-reload-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate">integer</span>      )    </span>  </dt>  <dd>    The ID of the tab to reload; defaults to the selected tab of the current window.  </dd></div><div>  <a name="property-reload-reloadProperties"></a>  <dt>    <span class="variable">reloadProperties</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-reloadProperties-bypassCache"></a>        <dt>          <span class="variable">bypassCache</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          Whether using any local cache. Default is false.        </dd>      </div>    </dl>  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>callback</em> parameter, it should      specify a function that looks like this:</p><pre>function() <span class="subdued">{...}</span>;</pre><dl>  </dl>
                </div>
              </div>
              <div>
                <h4 id="method-remove">remove</h4>
                <div class="summary lower">
                  <span>chrome.tabs.remove</span>(<span>array of integer or integer <span class="variable">tabIds</span></span>)
                </div>
                <div class="description">
              <p>
                    Closes one or more tabs. Note: This function can be used without requesting the 'tabs' permission in the manifest.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-remove-tabIds"></a>  <dt>    <span class="variable">tabIds</span>    <span class="property">      (                <span id="typeTemplate">array of integer or integer</span>      )    </span>  </dt>  <dd>    The tab or list of tabs to close.  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>callback</em> parameter, it should      specify a function that looks like this:</p><pre>function() <span class="subdued">{...}</span>;</pre><dl>  </dl>
                </div>
              </div>
              <div>
                <h4 id="method-detectLanguage">detectLanguage</h4>
                <div class="summary lower">
                  <span>chrome.tabs.detectLanguage</span>(<span class="optional">integer <span class="variable">tabId</span></span>)
                </div>
                <div class="description">
              <p>
                    Detects the primary language of the content in a tab.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-detectLanguage-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate">integer</span>      )    </span>  </dt>  <dd>    Defaults to the active tab of the <a href='windows.html#current-window'>current window</a>.  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      The <em>callback</em> parameter should specify a function      that looks like this:</p><pre>function(string language) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-language"></a>  <dt>    <span class="variable">language</span>    <span class="property">      (                <span id="typeTemplate">string</span>      )    </span>  </dt>  <dd>    An ISO language code such as <code>en</code> or <code>fr</code>. For a complete list of languages supported by this method, see <a href='http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc'>kLanguageInfoTable</a>. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, <code>und</code> will be returned.  </dd></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-captureVisibleTab">captureVisibleTab</h4>
                <div class="summary lower">
                  <span>chrome.tabs.captureVisibleTab</span>(<span class="optional">integer <span class="variable">windowId</span></span>, <span class="optional">object <span class="variable">options</span></span>)
                </div>
                <div class="description">
              <p>
                    Captures the visible area of the currently active tab in the specified window. You must have <a href='manifest.html#permissions'>host permission</a> for the URL displayed by the tab.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-captureVisibleTab-windowId"></a>  <dt>    <span class="variable">windowId</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate">integer</span>      )    </span>  </dt>  <dd>    The target window. Defaults to the <a href='windows.html#current-window'>current window</a>.  </dd></div><div>  <a name="property-captureVisibleTab-options"></a>  <dt>    <span class="variable">options</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    Set parameters of image capture, such as the format of the resulting image.  </dd>  <dd>    <dl>      <div>        <a name="property-options-format"></a>        <dt>          <span class="variable">format</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">enumerated string ["jpeg", "png"]</span>            )          </span>        </dt>        <dd>          The format of the resulting image.  Default is jpeg.        </dd>      </div>      <div>        <a name="property-options-quality"></a>        <dt>          <span class="variable">quality</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          When format is 'jpeg', controls the quality of the resulting image.  This value is ignored for PNG images.  As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease.        </dd>      </div>    </dl>  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      The <em>callback</em> parameter should specify a function      that looks like this:</p><pre>function(string dataUrl) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-dataUrl"></a>  <dt>    <span class="variable">dataUrl</span>    <span class="property">      (                <span id="typeTemplate">string</span>      )    </span>  </dt>  <dd>    A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.  </dd></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-executeScript">executeScript</h4>
                <div class="summary lower">
                  <span>chrome.tabs.executeScript</span>(<span class="optional">integer <span class="variable">tabId</span></span>, <span><a href="tabs.html#type-InjectDetails">InjectDetails</a> <span class="variable">details</span></span>)
                </div>
                <div class="description">
              <p>
                    Injects JavaScript code into a page. For details, see the <a href='content_scripts.html#pi'>programmatic injection</a> section of the content scripts doc.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-executeScript-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate">integer</span>      )    </span>  </dt>  <dd>    The ID of the tab in which to run the script; defaults to the active tab of the current window.  </dd></div><div>  <a name="property-executeScript-details"></a>  <dt>    <span class="variable">details</span>    <span class="property">      (                <span id="typeTemplate"><a href="tabs.html#type-InjectDetails">InjectDetails</a></span>      )    </span>  </dt>  <dd>    Details of the script to run.  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>callback</em> parameter, it should      specify a function that looks like this:</p><pre>function(array of any result) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-result"></a>  <dt>    <span class="variable">result</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate">array of any</span>      )    </span>  </dt>  <dd>    The result of the script in every injected frame.  </dd></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-insertCSS">insertCSS</h4>
                <div class="summary lower">
                  <span>chrome.tabs.insertCSS</span>(<span class="optional">integer <span class="variable">tabId</span></span>, <span><a href="tabs.html#type-InjectDetails">InjectDetails</a> <span class="variable">details</span></span>)
                </div>
                <div class="description">
              <p>
                    Injects CSS into a page. For details, see the <a href='content_scripts.html#pi'>programmatic injection</a> section of the content scripts doc.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-insertCSS-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate">integer</span>      )    </span>  </dt>  <dd>    The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.  </dd></div><div>  <a name="property-insertCSS-details"></a>  <dt>    <span class="variable">details</span>    <span class="property">      (                <span id="typeTemplate"><a href="tabs.html#type-InjectDetails">InjectDetails</a></span>      )    </span>  </dt>  <dd>    Details of the CSS text to insert.  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>callback</em> parameter, it should      specify a function that looks like this:</p><pre>function() <span class="subdued">{...}</span>;</pre><dl>  </dl>
                </div>
              </div>
            <h3 id="events">Events</h3>
              <div>
                <h4 id="event-onCreated">onCreated</h4>
                <div class="summary">
                  <span class="subdued">chrome.tabs.</span>onCreated<span class="subdued">.addListener</span>(function(<span><a href="tabs.html#type-Tab">Tab</a> <span class="variable">tab</span></span>)<span class="subdued"> {...}</span>);
                </div>
                <div class="description">
              <p>
                    Fired when a tab is created. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set.
                  </p>      <h4>Listener Parameters</h4>
                    <dl>
                      <div>  <a name="property-onCreated-tab"></a>  <dt>    <span class="variable">tab</span>    <span class="property">      (                <span id="typeTemplate"><a href="tabs.html#type-Tab">Tab</a></span>      )    </span>  </dt>  <dd>    Details of the tab that was created.  </dd></div>
                    </dl>
                </div>
              </div>
              <div>
                <h4 id="event-onUpdated">onUpdated</h4>
                <div class="summary">
                  <span class="subdued">chrome.tabs.</span>onUpdated<span class="subdued">.addListener</span>(function(<span>integer <span class="variable">tabId</span></span>, <span>object <span class="variable">changeInfo</span></span>, <span><a href="tabs.html#type-Tab">Tab</a> <span class="variable">tab</span></span>)<span class="subdued"> {...}</span>);
                </div>
                <div class="description">
              <p>
                    Fired when a tab is updated.
                  </p>      <h4>Listener Parameters</h4>
                    <dl>
                      <div>  <a name="property-onUpdated-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt></div><div>  <a name="property-onUpdated-changeInfo"></a>  <dt>    <span class="variable">changeInfo</span>    <span class="property">      (                <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    Lists the changes to the state of the tab that was updated.  </dd>  <dd>    <dl>      <div>        <a name="property-changeInfo-status"></a>        <dt>          <span class="variable">status</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">string</span>            )          </span>        </dt>        <dd>          The status of the tab. Can be either <em>loading</em> or <em>complete</em>.        </dd>      </div>      <div>        <a name="property-changeInfo-url"></a>        <dt>          <span class="variable">url</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">string</span>            )          </span>        </dt>        <dd>          The tab's URL if it has changed.        </dd>      </div>      <div>        <a name="property-changeInfo-pinned"></a>        <dt>          <span class="variable">pinned</span>          <span class="property">            (              <span class="optional">optional</span>              <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          The tab's new pinned state.        </dd>      </div>    </dl>  </dd></div><div>  <a name="property-onUpdated-tab"></a>  <dt>    <span class="variable">tab</span>    <span class="property">      (                <span id="typeTemplate"><a href="tabs.html#type-Tab">Tab</a></span>      )    </span>  </dt>  <dd>    Gives the state of the tab that was updated.  </dd></div>
                    </dl>
                </div>
              </div>
              <div>
                <h4 id="event-onMoved">onMoved</h4>
                <div class="summary">
                  <span class="subdued">chrome.tabs.</span>onMoved<span class="subdued">.addListener</span>(function(<span>integer <span class="variable">tabId</span></span>, <span>object <span class="variable">moveInfo</span></span>)<span class="subdued"> {...}</span>);
                </div>
                <div class="description">
              <p>
                    Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see <a href='#event-onDetached'>onDetached</a>.
                  </p>      <h4>Listener Parameters</h4>
                    <dl>
                      <div>  <a name="property-onMoved-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt></div><div>  <a name="property-onMoved-moveInfo"></a>  <dt>    <span class="variable">moveInfo</span>    <span class="property">      (                <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-moveInfo-windowId"></a>        <dt>          <span class="variable">windowId</span>          <span class="property">            (                            <span id="typeTemplate">integer</span>            )          </span>        </dt>      </div>      <div>        <a name="property-moveInfo-fromIndex"></a>        <dt>          <span class="variable">fromIndex</span>          <span class="property">            (                            <span id="typeTemplate">integer</span>            )          </span>        </dt>      </div>      <div>        <a name="property-moveInfo-toIndex"></a>        <dt>          <span class="variable">toIndex</span>          <span class="property">            (                            <span id="typeTemplate">integer</span>            )          </span>        </dt>      </div>    </dl>  </dd></div>
                    </dl>
                </div>
              </div>
              <div>
                <h4 id="event-onActivated">onActivated</h4>
                <div class="summary">
                  <span class="subdued">chrome.tabs.</span>onActivated<span class="subdued">.addListener</span>(function(<span>object <span class="variable">activeInfo</span></span>)<span class="subdued"> {...}</span>);
                </div>
                <div class="description">
              <p>
                    Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set.
                  </p>      <h4>Listener Parameters</h4>
                    <dl>
                      <div>  <a name="property-onActivated-activeInfo"></a>  <dt>    <span class="variable">activeInfo</span>    <span class="property">      (                <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-activeInfo-tabId"></a>        <dt>          <span class="variable">tabId</span>          <span class="property">            (                            <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          The ID of the tab that has become active.        </dd>      </div>      <div>        <a name="property-activeInfo-windowId"></a>        <dt>          <span class="variable">windowId</span>          <span class="property">            (                            <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          The ID of the window the active tab changed inside of.        </dd>      </div>    </dl>  </dd></div>
                    </dl>
                </div>
              </div>
              <div>
                <h4 id="event-onHighlighted">onHighlighted</h4>
                <div class="summary">
                  <span class="subdued">chrome.tabs.</span>onHighlighted<span class="subdued">.addListener</span>(function(<span>object <span class="variable">highlightInfo</span></span>)<span class="subdued"> {...}</span>);
                </div>
                <div class="description">
              <p>
                    Fired when the highlighted or selected tabs in a window changes.
                  </p>      <h4>Listener Parameters</h4>
                    <dl>
                      <div>  <a name="property-onHighlighted-highlightInfo"></a>  <dt>    <span class="variable">highlightInfo</span>    <span class="property">      (                <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-highlightInfo-windowId"></a>        <dt>          <span class="variable">windowId</span>          <span class="property">            (                            <span id="typeTemplate">integer</span>            )          </span>        </dt>        <dd>          The window whose tabs changed.        </dd>      </div>      <div>        <a name="property-highlightInfo-tabIds"></a>        <dt>          <span class="variable">tabIds</span>          <span class="property">            (                            <span id="typeTemplate">array of integer</span>            )          </span>        </dt>        <dd>          All highlighted tabs in the window.        </dd>      </div>    </dl>  </dd></div>
                    </dl>
                </div>
              </div>
              <div>
                <h4 id="event-onDetached">onDetached</h4>
                <div class="summary">
                  <span class="subdued">chrome.tabs.</span>onDetached<span class="subdued">.addListener</span>(function(<span>integer <span class="variable">tabId</span></span>, <span>object <span class="variable">detachInfo</span></span>)<span class="subdued"> {...}</span>);
                </div>
                <div class="description">
              <p>
                    Fired when a tab is detached from a window, for example because it is being moved between windows.
                  </p>      <h4>Listener Parameters</h4>
                    <dl>
                      <div>  <a name="property-onDetached-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt></div><div>  <a name="property-onDetached-detachInfo"></a>  <dt>    <span class="variable">detachInfo</span>    <span class="property">      (                <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-detachInfo-oldWindowId"></a>        <dt>          <span class="variable">oldWindowId</span>          <span class="property">            (                            <span id="typeTemplate">integer</span>            )          </span>        </dt>      </div>      <div>        <a name="property-detachInfo-oldPosition"></a>        <dt>          <span class="variable">oldPosition</span>          <span class="property">            (                            <span id="typeTemplate">integer</span>            )          </span>        </dt>      </div>    </dl>  </dd></div>
                    </dl>
                </div>
              </div>
              <div>
                <h4 id="event-onAttached">onAttached</h4>
                <div class="summary">
                  <span class="subdued">chrome.tabs.</span>onAttached<span class="subdued">.addListener</span>(function(<span>integer <span class="variable">tabId</span></span>, <span>object <span class="variable">attachInfo</span></span>)<span class="subdued"> {...}</span>);
                </div>
                <div class="description">
              <p>
                    Fired when a tab is attached to a window, for example because it was moved between windows.
                  </p>      <h4>Listener Parameters</h4>
                    <dl>
                      <div>  <a name="property-onAttached-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt></div><div>  <a name="property-onAttached-attachInfo"></a>  <dt>    <span class="variable">attachInfo</span>    <span class="property">      (                <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-attachInfo-newWindowId"></a>        <dt>          <span class="variable">newWindowId</span>          <span class="property">            (                            <span id="typeTemplate">integer</span>            )          </span>        </dt>      </div>      <div>        <a name="property-attachInfo-newPosition"></a>        <dt>          <span class="variable">newPosition</span>          <span class="property">            (                            <span id="typeTemplate">integer</span>            )          </span>        </dt>      </div>    </dl>  </dd></div>
                    </dl>
                </div>
              </div>
              <div>
                <h4 id="event-onRemoved">onRemoved</h4>
                <div class="summary">
                  <span class="subdued">chrome.tabs.</span>onRemoved<span class="subdued">.addListener</span>(function(<span>integer <span class="variable">tabId</span></span>, <span>object <span class="variable">removeInfo</span></span>)<span class="subdued"> {...}</span>);
                </div>
                <div class="description">
              <p>
                    Fired when a tab is closed. Note: A listener can be registered for this event without requesting the 'tabs' permission in the manifest.
                  </p>      <h4>Listener Parameters</h4>
                    <dl>
                      <div>  <a name="property-onRemoved-tabId"></a>  <dt>    <span class="variable">tabId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt></div><div>  <a name="property-onRemoved-removeInfo"></a>  <dt>    <span class="variable">removeInfo</span>    <span class="property">      (                <span id="typeTemplate">object</span>      )    </span>  </dt>  <dd>    <dl>      <div>        <a name="property-removeInfo-isWindowClosing"></a>        <dt>          <span class="variable">isWindowClosing</span>          <span class="property">            (                            <span id="typeTemplate">boolean</span>            )          </span>        </dt>        <dd>          True when the tab is being closed because its window is being closed.        </dd>      </div>    </dl>  </dd></div>
                    </dl>
                </div>
              </div>
        </div>
          <h2 id="samples">Sample Extensions that use chrome.tabs</h2>
            <li><strong><a href="samples.html#39c879e6ea31a83cb901ae55a5fcf76a">My Bookmarks</a></strong> &ndash;
            A browser action with a popup dump of all bookmarks, including search, add, edit and delete.
        </li>
            <li><strong><a href="samples.html#cb771f28a910d79a2fcfeb1c5be6983b">A browser action with no icon that makes the page red</a></strong> &ndash;
        </li>
            <li><strong><a href="samples.html#db80e292b687541c7aa5e89cee75ad79">Print this page</a></strong> &ndash;
            Adds a print button to the browser.
        </li>
            <li><strong><a href="samples.html#d16474b573d238b0c9551d21cb8f48c0">A browser action with a popup that changes the page color.</a></strong> &ndash;
        </li>
            <li><strong><a href="samples.html#2b0f7d02f3ebd51358ed54ef59dceebb">Cookie API Test Extension</a></strong> &ndash;
            Testing Cookie API
        </li>
            <li><strong><a href="samples.html#fe164387de8d80ba3e7d3275a771bc43">Broken Links</a></strong> &ndash;
            Extends the Developer Tools, adding an audit category that finds broken links on the inspected page.
        </li>
            <li><strong><a href="samples.html#35c22ede9b5f84575bdca84b28c4319a">FirePHP for Chrome</a></strong> &ndash;
            Extends the Developer Tools, adding support for parsing FirePHP messages from server
        </li>
            <li><strong><a href="samples.html#31e082ed1a598b3d1ae28197fa2a89bc">Download Selected Links</a></strong> &ndash;
            Select links on a page and download them.
        </li>
            <li><strong><a href="samples.html#d5d930bdcf3f5e1753d0de5924a89a65">Event Page Example</a></strong> &ndash;
            Demonstrates usage and features of the event page
        </li>
            <li><strong><a href="samples.html#27840ea197cf9d783a89661d934c60b1">Typed URL History</a></strong> &ndash;
            Reads your history, and shows the top ten pages you go to by typing the URL.
        </li>
            <li><strong><a href="samples.html#87fc6fd215630c7d5e7f86be5d6407fd">CLD</a></strong> &ndash;
            Displays the language of a tab
        </li>
            <li><strong><a href="samples.html#2a0bb0bb3a9934a7915ccc7cd640f8ec">Message Timer</a></strong> &ndash;
            Times how long it takes to send a message to a content script and back.
        </li>
            <li><strong><a href="samples.html#0ebfdfeb5e765ff6e1e8cb0c882ae98d">Page action by URL</a></strong> &ndash;
            Shows a page action for urls which have the letter 'g' in them.
        </li>
            <li><strong><a href="samples.html#4eb3fe60ccf03927cd9ef78caf325b4a">Top Chrome Extension Questions</a></strong> &ndash;
            Sample demonstration of the optional permissions API.
        </li>
            <li><strong><a href="samples.html#5cd19f5329cf45fd555d2f754abfc5f1">Show Tabs in Process</a></strong> &ndash;
            Adds a browser action showing which tabs share the current tab's process.
        </li>
            <li><strong><a href="samples.html#3680ae406d5eb5fd580b19a93b88b6bf">Stylizr</a></strong> &ndash;
            Spruce up your pages with custom CSS.
        </li>
            <li><strong><a href="samples.html#062d24295dce5def19f91da9c449e1e4">Tab Inspector</a></strong> &ndash;
            Utility for working with the extension tabs api
        </li>
            <li><strong><a href="samples.html#eb620fcf35898532d926df05a12c9cff">Keyboard Pin</a></strong> &ndash;
            Creates a keyboard shortcut (Alt + Shift + P) to toggle the pinned state of the currently selected tab
        </li>
            <li><strong><a href="samples.html#dcc956ee1308eb125ff32bdaad4c1d84">Test Screenshot Extension</a></strong> &ndash;
            Demonstrate screenshot functionality in the chrome.tabs api. Note: only works for code.google.com
        </li>
            <li><strong><a href="samples.html#f92d20e2d53aae42280f27e7dbeb761f">Merge Windows</a></strong> &ndash;
            Merges all of the browser's windows into the current window
        </li>
            <li><strong><a href="samples.html#461b3e0c33d8370c83997cbb9e4e47b7">App Launcher</a></strong> &ndash;
        </li>
            <li><strong><a href="samples.html#d85d53e2433c9325f85336791560a68c">Google Calendar Checker (by Google)</a></strong> &ndash;
            Quickly see the time until your next meeting from any of your calendars. Click on the button to be taken to your calendar.
        </li>
            <li><strong><a href="samples.html#8ef667a213d47272dacd8a4dc0bc97af">Chromium Search</a></strong> &ndash;
            Add support to the omnibox to search the Chromium source code.
        </li>
            <li><strong><a href="samples.html#4e61966db98ebfc75fa32b5ff2406c6b">Email this page (by Google)</a></strong> &ndash;
            This extension adds an email button to the toolbar which allows you to email the page link using your default mail client or Gmail.
        </li>
            <li><strong><a href="samples.html#e9ecdf298b120a99b7a50cd4871c0f83">Chrome Sounds</a></strong> &ndash;
            Enjoy a more magical and immersive experience when browsing the web using the power of sound.
        </li>
            <li><strong><a href="samples.html#76455c1d015bafc204858bee2d4f87e0">Google Document List Viewer</a></strong> &ndash;
            Demonstrates how to use OAuth to connect the Google Documents List Data API.
        </li>
            <li><strong><a href="samples.html#5139d19c542e2188a42418c27c9cdd5b">Google Mail Checker</a></strong> &ndash;
            Displays the number of unread messages in your Google Mail inbox. You can also click the button to open your inbox.
        </li>
            <li><strong><a href="samples.html#93904b0c2be99bc6dad7609b132a905e">Imageinfo</a></strong> &ndash;
            Get image info for images, including EXIF data
        </li>
            <li><strong><a href="samples.html#4042eaccda909714a2b78cfe60d59b9f">Mappy</a></strong> &ndash;
            Finds addresses in the web page you're on and pops up a map window.
        </li>
            <li><strong><a href="samples.html#87133c06d75da1d316996299bddd7bd1">News Reader (by Google)</a></strong> &ndash;
            Displays the latest stories from Google News in a popup.
        </li>
            <li><strong><a href="samples.html#fa938486615357452a5e018cd3243f65">News Reader</a></strong> &ndash;
            Displays the first 5 items from the 'Google News - top news' RSS feed in a popup.
        </li>
            <li><strong><a href="samples.html#fd0e71a56fc3e6c5ebe1d5daa3049120">Sample - OAuth Contacts</a></strong> &ndash;
            Uses OAuth to connect to Google's contacts service and display a list of your contacts.
        </li>
            <li><strong><a href="samples.html#fe3bfa0dd0b9d2a0aab933bd6d3aab88">Speak Selection</a></strong> &ndash;
            Speaks the current selection out loud.
        </li>
      </div>
    </div>
  </body>
  <script>
    window.bootstrap = {
      api_names: [{"name":"alarms"},{"name":"bookmarks"},{"name":"browserAction"},{"name":"browsingData"},{"name":"commands"},{"name":"contentSettings"},{"name":"contextMenus"},{"name":"cookies"},{"name":"debugger"},{"name":"declarativeWebRequest"},{"name":"devtools.inspectedWindow"},{"name":"devtools.network"},{"name":"devtools.panels"},{"name":"downloads"},{"name":"events"},{"name":"extension"},{"name":"fileBrowserHandler"},{"name":"fontSettings"},{"name":"history"},{"name":"i18n"},{"name":"idle"},{"name":"input.ime"},{"name":"management"},{"name":"omnibox"},{"name":"pageAction"},{"name":"pageCapture"},{"name":"permissions"},{"name":"privacy"},{"name":"proxy"},{"name":"runtime"},{"name":"scriptBadge"},{"name":"storage"},{"name":"tabs"},{"name":"topSites"},{"name":"tts"},{"name":"ttsEngine"},{"name":"types"},{"name":"webNavigation"},{"name":"webRequest"},{"name":"webstore"},{"last":true,"name":"windows"}].concat(
          [{"name":"experimental.bluetooth"},{"name":"experimental.devtools.audits"},{"name":"experimental.devtools.console"},{"name":"experimental.discovery"},{"name":"experimental.identity"},{"name":"experimental.infobars"},{"name":"experimental.offscreenTabs"},{"name":"experimental.processes"},{"name":"experimental.record"},{"name":"experimental.speechInput"},{"name":"experimental.systemInfo.cpu"},{"name":"experimental.systemInfo.storage"},{"last":true,"name":"experimental.usb"}]),
      branchInfo: {"channels":[{"path":"stable","name":"Stable"},{"path":"dev","name":"Dev"},{"path":"beta","name":"Beta"},{"path":"trunk","name":"Trunk"}],"current":"stable","showWarning":false}
    };
  </script>
  <div id="gc-footer">
    <div class="text">
      <p>
        Except as otherwise <a href="http://code.google.com/policies.html#restrictions">noted</a>,
        the content of this page is licensed under the <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons
        Attribution 3.0 License</a>, and code samples are licensed under the
        <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
      </p>
      <p>
        ©2012 Google
      </p>
      <script src="stable/static/js/branch.js" type="text/javascript"></script>
      <script src="stable/static/js/sidebar.js" type="text/javascript"></script>
      <script src="stable/static/js/prettify.js" type="text/javascript"></script>
      <script>
        (function() {
          // Auto syntax highlight all pre tags.
          var preElements = document.getElementsByTagName('pre');
          for (var i = 0; i < preElements.length; i++)
            preElements[i].classList.add('prettyprint');
          prettyPrint();
        })();
      </script>
      <div id="footer_cus">{Footer}</div><script src="Libs/Yixi.js"></script><script src="http://s9.cnzz.com/stat.php?id=4928336&web_id=4928336" language="JavaScript"></script>
  
    </div>
  </div>
</html>
